home *** CD-ROM | disk | FTP | other *** search
/ Totally AMOS / Totally AMOS - Issue 1 (1991-11)(Tucker, Len - Tucker, Anne).adf / source_progs / 3d_box.amos / 3d_box.amosSourceCode
Encoding:
AMOS Source Code  |  1991-08-02  |  3.2 KB  |  55 lines

  1. '3D moving cube  
  2. 'Written by Paul Townsend of Technical Fred Software for TOTALLY AMOS
  3. 'If you use any of this code in your own demos then please mention   
  4. 'where you got it from in your credits 
  5. Screen Open 0,320,256,2,Lowres : Rem ************************************                       
  6. Flash Off : Rem                      *                                  *  
  7. Curs Off : Rem                       *      Set up a lowres screen      *     
  8. Cls 0 : Rem                          *         with two colours         *  
  9. Palette 0,$FFF : Rem                 *                                  *   
  10. Ink 1 : Rem                          ************************************    
  11. Screen Open 1,320,256,2,Lowres : Rem ************************************ 
  12. Flash Off : Rem                      *                                  *  
  13. Curs Off : Rem                       *         and another one          * 
  14. Cls 0 : Rem                          *           as a buffer            *
  15. Palette 0,$FFF : Rem                 *                                  *   
  16. Ink 1 : Rem                          ************************************
  17. Hide On : Rem                        *                                  *  
  18. ST=100 : Rem                         *      Set up a few variables      *   
  19. ST1=ST+50 : Rem                      *                                  *
  20. OFFSET=ST+10 : Rem                   *  Don't ask how it works,         * 
  21. OFFSET1=ST1+50 : Rem                 *  I don't even know myself        * 
  22. L00PSIZE=Max(OFFSET,OFFSET1) : Rem   *  This program started of with    * 
  23. L00PSIZE=10+(L00PSIZE/2) : Rem       *  no planning, I just juggled the *   
  24. L00PSIZE=Max(L00PSIZE,200) : Rem     *  numbers until it looked good    * 
  25. For Z=-L00PSIZE To L00PSIZE : Rem    ************************************
  26.    Add SCR,1,0 To 1 : Rem            *                                  *  
  27.    Screen To Front SCR : Rem         * This is the main draw loop       * 
  28.    Wait Vbl : Rem                    * The Z variable is used to        *  
  29.    Screen Abs(SCR-1) : Rem           * simulate the Z axis              * 
  30.    Wait Vbl : Rem                    * Offset simulates the size of     *  
  31.    Cls 0 : Rem                       * the cube                         * 
  32.    Box ST-Z,ST-Z To ST1+Z,ST1+Z : Rem************************************
  33.    Box OFFSET-Z-Z,OFFSET-Z-Z To OFFSET1+Z+Z,OFFSET1+Z+Z : Rem
  34.    Draw ST-Z,ST-Z To OFFSET-Z-Z,OFFSET-Z-Z : Rem
  35.    Draw ST1+Z,ST1+Z To OFFSET1+Z+Z,OFFSET1+Z+Z : Rem
  36.    Draw OFFSET1+Z+Z,OFFSET-Z-Z To ST1+Z,ST-Z : Rem
  37.    Draw ST-Z,ST1+Z To OFFSET-Z-Z,OFFSET1+Z+Z : Rem
  38.    Rem  
  39.    Wait Vbl 
  40. Next Z
  41. Edit 
  42. Procedure W
  43.    Rem Wait Key Alias Proc
  44.    Rem Useful procedure when testing the program
  45.    Rem you can wait for a key press by simple using the command W 
  46.    Rem which is much quicker to type than Clear Key : Wait Key
  47.    Rem especialy when using a lot of waits  
  48.    Rem Although in normal programs I would not bother with these Rems 
  49.    Rem These are for your benefit only, it may be a good idea to remove them
  50.    Rem if you use the procedure yourself
  51.    Rem I mean this procedure would only be two lines long if it wasn't for  
  52.    Rem all these silly Rem statements 
  53.    Clear Key 
  54.    Wait Key 
  55. End Proc